import request from '../../utils/Request'
import PageUtils from '../../utils/PageUtils'

export const saveNotice = data => {
    return request({
        method: 'post',
        url: '/api/manage/notice/save',
        data: data
    })
}

export const createNotice = (data, idempotentCode) => {
    return request({
        method: 'post',
        url: '/api/manage/notice/create',
        data: data,
        headers: {
            common: {
                idempotent: idempotentCode
            }
        }
    })
}

export const updateNotice = data => {
    return request({
        method: 'post',
        url: '/api/manage/notice/update',
        data: data
    })
}

export const updateNoticeStatus = (noticeId, status) => {
    return request({
        method: 'get',
        url: '/api/manage/notice/' + noticeId + '/status/' + status,
        params: {}
    })
}

export const deleteNotice = bId => {
    return request({
        method: 'get',
        url: '/api/manage/notice/delete/' + bId,
        params: {}
    })
}

export const listNotice = (data, current, size) => {
    let pageUrl = PageUtils.page(current, size)
    return request({
        method: 'get',
        url: '/api/manage/notice/list?' + pageUrl,
        params: data
    })
}


export const selectNotice = bId => {
    return request({
        method: 'get',
        url: '/api/manage/notice/select/' + bId,
        params: {}
    })
}